package ru.papergames.model.binsocket.packets
{
	import flash.utils.getQualifiedClassName;
	
	import mx.utils.ObjectUtil;
	
	import ru.papergames.model.binsocket.data.ExtByteArray;
	
	public class BaseSocketPacket
	{
		public var packetID:uint;
		
		protected var binaryData:ExtByteArray;		
		
		public function getName():String {
			return getQualifiedClassName(this).replace(/^.+::/, '');
		}
		
		public function toString():String {
			return getName() + ': ' + (binaryData ? binaryData.toString() : 'null') + "\n" + this.dump(); 
		} 
		
		public function dump():String {
			return ObjectUtil.toString(this).replace(/^.+::/, '');
		}
	}
}